package main

import (
	"fmt"
	"io/ioutil"
	"regexp"
)

var genderRe = regexp.MustCompile(`"genderString":"([^"]+)",`)
var heightRe = regexp.MustCompile(`"heightString":"([^"]+)",`)
var educationRe = regexp.MustCompile(`"educationString":"([^"]+)",`)
var basicRe = regexp.MustCompile(`"basicInfo":\["([^"]+)","([^"]+)","([^"]+)","([^"]+)","([^"]+)","([^"]+)","([^"]+)","([^"]+)","([^"]+)"\],`)
var nameRe = regexp.MustCompile(`<title>【(.*)】.*</title>`)
func main() {
	contents, err := ioutil.ReadFile("crawler/xcar/parser/cardetail_test_data.html")
	if err !=nil {
		panic(err)
	}

	//content:= "<title>【小鹏G32020款520 悦享版】报价_图片_参数-爱卡汽车</title>"
	nameMatch := nameRe.FindSubmatch([]byte(contents))
	fmt.Printf("name=%s\n",nameMatch[1])

	//genderMatch := genderRe.FindSubmatch(contents)
	//
	//
	//m := basicRe.FindSubmatch(contents)
	//profile := model.Profile{}
	//
	//if len(m) >0 {
	//	profile.Marriage = string(m[1])
	//	profile.Age = string(m[2])
	//	profile.Xinzuo= string(m[3])
	//	profile.Height = string(m[4])
	//	profile.Weight = string(m[5])
	//	profile.Hokou = string(m[6])
	//	profile.Income= string(m[7])
	//	profile.Occupation= string(m[8])
	//	profile.Education= string(m[9])
	//	profile.Gender = string(genderMatch[1])
	//}
	//
	//
	//fmt.Printf("%s\n",profile.Gender)
	//fmt.Printf("%s\n",profile.Age)
	//fmt.Printf("%s\n",profile.Height)
	//fmt.Printf("%s\n",profile.Weight)
	//fmt.Printf("%s\n",profile.Income)
	//fmt.Printf("%s\n",profile.Marriage)
	//fmt.Printf("%s\n",profile.Education)
	//fmt.Printf("%s\n",profile.Occupation)
	//fmt.Printf("%s\n",profile.Hokou)
	//fmt.Printf("%s\n",profile.Xinzuo)
	//fmt.Printf("%s\n",profile.House)
	//fmt.Printf("%s\n",profile.Car)


}
